package com.hspedu.newData.dmsxl.队列;

import java.util.ArrayDeque;
import java.util.Queue;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-25 
 * @Version: 1.0
 */

public class LC933最近的请求次数 {

    class RecentCounter {

        Queue<Integer> queue;

        public RecentCounter() {
            queue = new ArrayDeque<>();
        }

        public int ping(int t) {

            queue.offer(t);
            while (queue.peek() > t-3000){
                queue.poll();
            }

            return queue.size();

        }
    }

}
